Ext.ux.collapsedPanelTitlePlugin = function ()
{
    this.init = function(p) {
        if (p.collapsible)
        {
            var r = p.region;
            if ((r == 'north') || (r == 'south'))
            {
                p.on ('render', function()
                    {
                        var ct = p.ownerCt;
                        ct.on ('afterlayout', function()
                            {
                                if (ct.layout[r].collapsedEl)
                                {
                                    var leftPadding = ( p.collapsedIcon ? 24 : 4 );
                                    var background = ( p.collapsedIcon ? "url('" + p.collapsedIcon + "') no-repeat left center;" : "transparent;" );
                                    p.collapsedTitleEl = ct.layout[r].collapsedEl.createChild ({
                                        tag: 'div',
                                        style: 'padding-left:' + leftPadding + 'px; margin-left:4px; margin-top:2px; background:'+ background,
                                        cls: 'x-panel-collapsed-text',
                                        html: p.collapsedTitle
                                    });
                                }
                            }, false, {single:true});
                        p.on ('collapse', function()
                            {
                                if (ct.layout[r].collapsedEl && !p.collapsedTitleEl)
                                {
                                    var leftPadding = ( p.collapsedIcon ? 24 : 4 );
                                    var background = ( p.collapsedIcon ? "url('" + p.collapsedIcon + "') no-repeat left center;" : "transparent;" );
                                    p.collapsedTitleEl = ct.layout[r].collapsedEl.createChild ({
                                        tag: 'span',
                                        style: 'padding-left:' + leftPadding + 'px; margin-left:4px; margin-top:2px; background:'+ background,
                                        cls: 'x-panel-collapsed-text',
                                        html: p.collapsedTitle
                                    });
                                }
                            }, false, {single:true});
                    });
            }
        }
    };
}